package edu.umn.msse.farside.FourH.services;

import edu.umn.msse.farside.FourH.domain.Event;
import edu.umn.msse.farside.FourH.domain.Position;
import edu.umn.msse.farside.FourH.domain.Volunteer;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: corcutt
 * Date: Feb 10, 2009
 * Time: 6:33:55 PM
 *
 * A service to provide CRUD for events and other database access for Events.
 */
public interface EventService
{
    /**
     * Create of an event in the database
     * @param event The event to be added to the repository
     */
    @Transactional
    public void addEvent(Event event);

    /**
     * Retrieve an event from the repository
     * @param event The event
     * @return an event retrieved from the repository
     */
    public Event getEvent(Event event);

    /**
     * Retrieve an event from the repository
     * @param id The event id
     * @return an event retrieved from the repository
     */
    public Event getEvent(Long id);

    /**
     * Retrieve a position from the repository
     * @param id The Position id
     * @return a position retrieved from the repository
     */
    public Position getPosition(Long id);

    /**
     * Get all the events
     * @return
     */
    public List getEvents();

    /**
     * Update information about an event and its position
     * @param event The event to be updated
     */
    @Transactional
    public Event updateEvent(Event event);

    /**
     * Update information about an Position and its position
     * @param position The Position to be updated
     */
    @Transactional
    public Position updatePosition(Position position);

    /**
     * Remove information about an event and its position
     * @param event The event to be removed
     */
    @Transactional
    public void removeEvent(Event event);


    /**
     * Add positions to an event
     * @param event
     * @param positions
     */
    @Transactional
    public void addPositions(Event event, List<Position> positions);

    /**
     * Add positions to an event
     * @param event
     * @param position
     */
    @Transactional
    public void addPosition(Event event, Position position);


    /**
     * Remove position from an event
     * @param event
     * @param position
     */
    @Transactional
    public void removePosition(Event event, Position position);

    /**
     * Provide a list of all future events in the repository
     * @return a list of all future events in the repository
     */
    public Collection<Event> listActiveEvents();

    /**
     * Provide a list of all events created by the user.
     * @param volunteer
     * @return
     */
    public List<Event> getEventsForUser(Volunteer volunteer);

    /**
     * Provide a list of all positions for an event
     *
     * @param event
     *
     */
    public Collection<Position> listAllPositions(Event event);

    /**
     * Provide a list of all filled positions of an event
     *
     * @param event
     */
    public Collection<Position> listFilledPositions(Event event);

    /**
     * Provide a list of all open (unfilled) positions of an event
     *
     * @param event
     */
    public Collection<Position> listUnfilledPositions(Event event);


}
